package com.bytenebula.entity.core;

import cn.hutool.core.date.DateTime;
import com.mybatisflex.annotation.*;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.sql.Timestamp;

@EqualsAndHashCode(callSuper = true)
@Data
public abstract class BaseEntity extends BnEntity {

    public BaseEntity() {
        this.is_delete = 0;
        this.is_active = 1;
        this.createTime = DateTime.now().toTimestamp();
        this.createUserId = 0;
        this.lastModifiedTime = DateTime.now().toTimestamp();
        this.lastModifiedUserId = 0;
    }

    /**
     * 对象编号
     */
    @Id(keyType = KeyType.Auto)
    private Integer id;

    /**
     * 逻辑删除
     */
    @Column(isLogicDelete = true)
    private Integer is_delete;

    /**
     * 激活状态
     */
    private Integer is_active;

    /**
     * 创建时间
     */
    private Timestamp createTime;

    /**
     * 创建用户编号
     */
    private Integer createUserId;

    /**
     * 最后修改时间
     */
    private Timestamp lastModifiedTime;

    /**
     * 最后修改用户编号
     */
    private Integer lastModifiedUserId;
}
